package com.example.springbootdemo.controller;

import com.example.springbootdemo.model.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @author dingrz
 * @date 2022-01-20
 */
@RestController
public class HelloController {

    @GetMapping("/hello")
    public String sayHello() {
        return "Hello, world." + getWord();
    }

    @GetMapping("/hi")
    public String sayHi() {
        return "Hi, world." + getWord();
    }

    private String getWord() {
        try {
            Thread.sleep( new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "";
    }

}
